﻿/***************************************************************************
 * 文件名：ChinaUnion
 * 功能：
 * 说明：
 * -------------------------------------------------------------------------
 * 创建时间：2024/5/22 11:06:01
 * 创建人：林远
 * 邮箱： 17682102673@qq.com
 * =========================================================================
 *
 * 修改人：   
 * 修改时间：   
 * 修改说明：   
 ***************************************************************************/
using BankAccValidator.Interface;
using MySystem.Interface;
using MySystem.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace BankAccValidator.BankBus
{
    #region 账户验证

    internal class ChinaUnion_B01PostParam : IBusPostParam
    {
        #region Properties

        /// <summary>
        /// 商户Id
        /// </summary>
        public string appId { get; set; }

        /// <summary>
        /// 商户密码
        /// </summary>
        public string appPwd { get; set; }

        public PostBody data { get; set; }

        #region class

        public class PostBody
        {
            /// <summary>
            /// 查询类型
            /// </summary>
            public string tradeType { get; set; }

            /// <summary>
            /// 卡号
            /// </summary>
            public string cardNo { get; set; }

            /// <summary>
            /// 姓名
            /// </summary>
            public string customerNm { get; set; }

            /// <summary>
            /// 手机号
            /// </summary>
            public string phoneNo { get; set; }

            /// <summary>
            /// 证件号（RSA加密）
            /// </summary>
            public string certifId { get; set; }

            /// <summary>
            /// 证件类型
            /// </summary>
            public string certifTp { get; set; }

            /// <summary>
            /// 银行卡CVN2
            /// </summary>
            public string CVN2 { get; set; }

            /// <summary>
            /// 有效期
            /// </summary>
            public string expired { get; set; }

            /// <summary>
            /// 订单号
            /// </summary>
            public string orderId { get; set; }

            /// <summary>
            /// 交易场景
            /// </summary>
            public string transCode { get; set; }
        }
        #endregion

        #endregion

        public void InsertToPostParam(HttpWebUtil util)
        {
            util.SetParam();
        }
    }

    internal class ChinaUnion_B01PostResult : IPostResult, IBusSelfcheckable
    {
        #region Requrest

        /// <summary>
        /// 应答码
        /// </summary>
        public string responseCode { get; set; }

        /// <summary>
        /// 应答消息
        /// </summary>
        public string message { get; set; }

        /// <summary>
        /// 应答报文
        /// </summary>
        public string data { get; set; }

        #endregion

        public BankBusCheckResult CheckSelf()
        {
            var result = new ChinaUnion_B01CheckResult();

            if (this.responseCode != "0")
            {
                result.PassCheck = false;
                result.CheckMessage = "中国银联账户验证失败！";
            }

            return result;
        }
    }

    public class ChinaUnion_B01CheckResult : BankBusCheckResult
    {

    }

    #endregion
}